<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" type="text/css" href="__CSS__/main.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/common.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/font-awesome.css" />
    <script type="text/javascript" src="__EXTEND__/lib/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
    <![endif]-->
    <title>部门管理</title>
</head>
<body>
<div class="contant">
<div class="row"> <h3 class="page-header">部门管理</h3></div>
<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-body">
                <label><a class="btn btn-primary" href="{:U('Group/add')}">添加部门</a></label>
                <div class="table-responsive">
                    <table class="table table-striped table-bordered">
                        <thead>
                            <tr>
                                <th width="60"></th>
                                <th>部门名称</th>
                                <th width="75">状态</th>
                                <th width="400">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <volist name="list" id="list">
                                <tr class="level{$list.pid} <gt name='list.pid' value='0'> hide </gt>">
                                    <if condition="$list.pid lt 1">
                                        <td>
                                            <i data-id="{$list.id}" data-open='1' class="fa <lt name='list.type' value='2'> fa-plus open </lt>"></i>
                                        </td>
                                    <else />
                                        <td></td>
                                    </if>
                                    <td>
                                       <switch name='list.type'>
                                           <case value="0"></case>
                                           <case value="1">&nbsp;<i class="fa fa-long-arrow-right" aria-hidden="true"></i>&nbsp;</case>
                                           <!-- <case value="2">&nbsp;|&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;|-&nbsp;&nbsp;&nbsp;</case> -->
                                       </switch>{$list.name}
                                    </td>
                                    <td>
                                        <button class='btn <eq name="list.status" value="1">btn-primary<else />btn-default</eq> btn-sm setStatus' type="button" data-url='{:U("Group/setStatus?id=".$list["id"])}' data-status="{$list.status}"><eq name="list.status" value='1'>启用<else />禁用</eq></button>
                                    </td>
                                    <td>
                                        <a class="btn-sm btn btn-default" href='{:U("Group/rule?id=".$list["id"])}'>权限</a>
                                        <a class="btn-sm btn btn-default" href='{:U("Group/edit?id=".$list["id"])}'>修改</a>
                                        <button data-url='{:U("Group/del?id=".$list["id"])}' class="btn-sm btn btn-default delBtn" type="button">删除</button>
                                        <if condition='$list.work_status eq 1'>
                                          <a class="btn-sm btn btn-default" href='{:U("Group/addInfo?id=".$list["id"])}'>完善信息</a>
                                        </if>
                                    </td>
                                </tr>
                            </volist>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
<script type="text/javascript">
    $(function(){
        $('.open').click(function(){
            if($(this).data('open') == 0){
                $(this).removeClass('fa-minus').addClass('fa-plus');
                $('.level'+$(this).data('id')).addClass('hide');
            }else{
                $(this).removeClass('fa-plus').addClass('fa-minus');
                $('.open td:eq(0)').attr('class','');
                $('.level'+$(this).data('id')).removeClass('hide');
            }
            $(this).data('open', $(this).data('open') == 1 ? 0 : 1);
        });
    })
</script>
</body>
</html>